<?php
session_start();
if(isset($_SESSION['admin_id_user']) && $_SESSION['admin_id_user']!=""){   
   header("Location: /quocha/admin/index.php");
}
//------------------------
include_once $_SERVER['DOCUMENT_ROOT'] . '/quocha/lib/Useradmin.php';
$userOb = new Useradmin();
if (isset($_POST['tendangnhap']) && isset($_POST['matkhau'])) {
    if ($userOb->kiemtradangnhapadmin($_POST['tendangnhap'], $_POST['matkhau'])) {
        header('Location: /quocha/admin/index.php');
    } else {
        header('Location: /quocha/admin/login.php');
    }
}
?>
<html>
    <head>
        <title>Login</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link href="login.css" rel="stylesheet">
    </head>
    <body>
        <div class="box">
            <form method="post" action="">
                <h2 align="center">ĐĂNG NHẬP HỆ THỐNG QUẢN LÝ</h2>
                <table cellspacing="10" cellpadding="0" style="width: 100%">
                    <tbody>
                        <tr>
                        <td rowspan="4"><img width="110px" height="110px" src="img/key.jpg"></td>
                        <td colspan="2">&nbsp;</td>
                        </tr>
                        <tr>
                            <td><b>Tên tài khoản:</b></td>
                            <td><input type="text" name="tendangnhap"/></td>
                        <tr>
                            <td><b>Mật khẩu:</b></td>
                            <td><input type="password" name="matkhau"/></td>
                        </tr>
                        <tr>
                            <td></td>
                            <td><button type="submit">Đăng nhập</button></td>
                        </tr>
                    </tbody>
                </table>
            </form>
        </div>
    </body>
</html>